import java.io.File;
import java.io.FileInputStream;
import java.util.Collection;

import jxl.Workbook;
import org.junit.After;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;

import com.googlecode.fightinglayoutbugs.FightingLayoutBugs;
import com.googlecode.fightinglayoutbugs.LayoutBug;
import com.googlecode.fightinglayoutbugs.WebPage;


public class sree {

	WebDriver driver=new InternetExplorerDriver();
	
	@Test
	public void test() throws Exception {
		FileInputStream fi=new FileInputStream("C:\\Users\\TSATI2\\Desktop\\url1.xls");
		Workbook w=Workbook.getWorkbook(fi);
		 jxl.Sheet s=w.getSheet(0);
		driver.get("http://www.google.com");
		 WebPage webPage = new WebPage(driver);
	     FightingLayoutBugs flb = new FightingLayoutBugs();
	     flb.setScreenshotDir(new File("C:\\snapshot"));
	     final Collection<LayoutBug> layoutBugs = flb.findLayoutBugsIn(webPage);
	     System.out.println("Found " + layoutBugs.size() + " layout bug(s).");
	    for (LayoutBug bug : layoutBugs) {
	      System.out.println(bug);
	      }
		for(int i=0;i<s.getRows();i++)
		{
			
	    WebElement searchbox=driver.findElement(By.name("q"));
		searchbox.sendKeys(s.getCell(0,i).getContents());	
		WebElement go= driver.findElement(By.name("btnG"));
		go.click();
		searchbox.clear();
		}
	}
		@After
	public void test1()	throws Exception
	{
	driver.quit();
	}


}

